<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                xmlns:security="http://www.springframework.org/security/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">甲方数据变更</ui:define>
    <ui:define name="content">
        <h:form>
            <p:defaultCommand target="search"/>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="left">
                        <p:commandButton id="toggler" type="button" value="展示选择"
                                         style="width: auto;"
                                         icon="ui-icon-calculator"/>
                        <p:columnToggler datasource="recordDataTable" trigger="toggler"/>
                    </f:facet>
                    <f:facet name="right">
                        <p:commandButton id="add" value="新增" icon="fa fa-plus"
                                         process="@this" action="#{firstpartyDataListBean.onAdd}">
                            <f:setPropertyActionListener
                                    value="/views/settlement/data-update/firstparty/firstparty-data-list.xhtml"
                                    target="#{currentUserBean.back}"/>
                        </p:commandButton>
                        <p:commandButton id="search" value="查询" icon="fa fa-search" update="@form"/>
                        <p:commandButton value="重置" icon="fa fa-refresh"
                                         process="@this"
                                         update="@form"
                                         actionListener="#{firstpartyDataListBean.onReset}"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-g ui-fluid" style="padding-top: 30px;">
                <div class="ui-g-12 ">
                    <div class="ui-g-12 card">
                        <h1>查询条件</h1>
                        <div class="ui-g-1">
                            <p:outputLabel value="变更日期"/>
                        </div>
                        <div class="ui-g-3">
                            <p:calendar value="#{firstpartyDataListBean.$.startTime}"
                                        id="recordStartTime" styleClass="autoWidthCalendar"
                                        locale="#{constants:get('LOCALE')}"
                                        timeZone="#{constants:get('TIME_ZONE')}"
                                        pattern="#{constants:get('DATE_FORMAT')}"/>
                            <span>—</span>
                            <p:calendar value="#{firstpartyDataListBean.$.endTime}"
                                        id="recordEndTime" styleClass="autoWidthCalendar"
                                        locale="#{constants:get('LOCALE')}"
                                        timeZone="#{constants:get('TIME_ZONE')}"
                                        pattern="#{constants:get('DATE_FORMAT')}"/>
                        </div>

                        <div class="ui-g-1">
                            <p:outputLabel value="公司名称"/>
                        </div>
                        <div class="ui-g-3">
                            <p:inputText value="#{firstpartyDataListBean.$.companyName}"/>
                        </div>

                    </div>
                </div>
                <div class="ui-g-12">
                    <div class="ui-g-12 card">
                        <h1>查询结果</h1>
                        <p:dataTable id="recordDataTable"
                                     style="width:250%;text-align: center"
                                     var="record"
                                     value="#{firstpartyDataListBean.lazyDataModel}"
                                     rows="#{constants:get('ROWS')}"
                                     lazy="true"
                                     paginator="true"
                                     paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                     rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                     emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                     scrollable="true"
                                     scrollWidth="97%"
                                     reflow="true"
                                     selection=""
                                     resizableColumns="true">
                            <!--<p:column headerText="操作">
                                <p:splitButton icon="fa fa-eye"
                                               process="@this">
                                </p:splitButton>
                            </p:column>-->
                            <p:column headerText="变更时间">
                                <h:outputText value="#{record.updateTime}">
                                    <f:convertDateTime pattern="#{constants:get('DATETIME_FORMAT')}"/>
                                </h:outputText>
                            </p:column>
                            <p:column headerText="变更人">
                                <h:outputText value="#{record.updator}"/>
                            </p:column>
                            <p:column headerText="公司名称">
                                <h:outputText value="#{record.companyName}"/>
                            </p:column>
                            <p:column headerText="合作模式">
                                <h:outputText
                                        value="#{firstpartyDataListBean.translate(DictionaryCode.COOPERATION_MODE,record.copMode)}"/>
                            </p:column>
                            <p:column headerText="结算类型">
                                <h:outputText value="#{record.settlementType==0?'日结':'周结'}"/>
                            </p:column>
                            <p:column headerText="结算开始日期">
                                <h:outputText value="#{record.settlementStartTime}">
                                    <f:convertDateTime pattern="#{constants:get('DATE_FORMAT')}"/>
                                </h:outputText>
                            </p:column>
                            <p:column headerText="结算结束日期">
                                <h:outputText value="#{record.settlementEndTime}">
                                    <f:convertDateTime pattern="#{constants:get('DATE_FORMAT')}"/>
                                </h:outputText>
                            </p:column>
                            <p:column headerText="结算价格(%)">
                                <h:outputText value="#{record.settlementPercentPrice==null?'-':record.settlementPercentPrice}"/>
                            </p:column>
                            <p:column headerText="结算价格(元)">
                                <h:outputText value="#{record.settlementYuanPrice==null?'-':record.settlementYuanPrice}"/>
                            </p:column>
                            <p:column headerText="旧推广渠道">
                                <h:outputText
                                        value="#{firstpartyDataListBean.translate(DictionaryCode.SETTLEMENT_SPREAD_CHANNEL,record.oldSpreadChannel)}"/>
                            </p:column>
                            <p:column headerText="新推广渠道">
                                <h:outputText
                                        value="#{record.newSpreadChannel == null?'-':firstpartyDataListBean.translate(DictionaryCode.SETTLEMENT_SPREAD_CHANNEL,record.newSpreadChannel)}"/>
                            </p:column>
                            <p:column headerText="旧的注册数">
                                <h:outputText value="#{record.oldRegisterCount==null ? '-':record.oldRegisterCount}"/>
                            </p:column>
                            <p:column headerText="新的注册数">
                                <h:outputText value="#{record.newRegisterCount==null ? '-':record.newRegisterCount}"/>
                            </p:column>
                            <p:column headerText="旧的放款金额">
                                <h:outputText value="#{record.oldLoanAmount ==null ? '-':record.oldLoanAmount}">
                                    <f:convertNumber pattern="###,###.00"/>
                                </h:outputText>
                            </p:column>
                            <p:column headerText="新的放款金额">
                                <h:outputText value="#{record.newLoanAmount==null ? '-':record.newLoanAmount}">
                                    <f:convertNumber pattern="###,###.00"/>
                                </h:outputText>
                            </p:column>
                            <p:column headerText="旧的点击数">
                                <h:outputText value="#{record.oldClickCount ==null ? '-':record.oldClickCount}"/>
                            </p:column>
                            <p:column headerText="新的点击数">
                                <h:outputText value="#{record.newClickCount==null ? '-':record.newClickCount}"/>
                            </p:column>
                            <p:column headerText="旧的结算金额">
                                <h:outputText value="#{record.oldSettlementAmount}">
                                    <f:convertNumber pattern="###,###.00"/>
                                </h:outputText>
                            </p:column>
                            <p:column headerText="新的结算金额">
                                <h:outputText value="#{record.newSettlementAmount==null ? '-':record.newSettlementAmount}">
                                    <f:convertNumber pattern="###,###.00"/>
                                </h:outputText>
                            </p:column>
                            <p:column headerText="甲方数据创建人">
                                <h:outputText value="#{record.firstpartyCreator}"/>
                            </p:column>

                            <p:column headerText="甲方数据创建时间">
                                <h:outputText value="#{record.firstpartyCreateTime}">
                                    <f:convertDateTime pattern="#{constants:get('DATETIME_FORMAT')}"/>
                                </h:outputText>
                            </p:column>
                            <p:column headerText="备注">
                                <h:outputText value="#{record.remark}"/>
                            </p:column>
                        </p:dataTable>
                    </div>

                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
